var app = getApp();
Page({
  data: {
    jinriz_price:0,
    jinriz_num:0,
    xszf_price:0,
    xszf_num:0,
    fpzf_price:0,
    fpzf_num:0,
    xxzf_price:0,
    xxzf_num:0,
    btzf_price:0,
    btzf_num:0,
    xxyezf_price:0,
    xxyezf_num:0,
    yezf_price:0,
    yezf_num:0,
    hbzf_price:0,
    hbzf_num:0,
  },
  onLoad: function(options) {
    
  },

  onShow:function(){
    var store_id = wx.getStorageSync("store_id");
    console.log(store_id)
    if(!store_id){
      this.setData({
        store_id:0
      })
      app.showToast("请登录小程序")

    }else{
      this.setData({
        store_id:wx.getStorageSync("store_id")
      })
      this.getProfitSituation();
    }
  },

  getProfitSituation:function(){
    var t = this;
    app.visit("account/getProfitSituation", {
      store_id:t.data.store_id
    }, "", function(c) {
      console.log(c)
      if(0 == c.code){
        t.setData({
          info:c.data.info,
          jinriz_price:c.data.zong_price,
          jinriz_num:c.data.zong_num,
          xszf_price:c.data.xs.wxzf_price,
          xszf_num:c.data.xs.wxzf_num,
          fpzf_price:c.data.xs.fpzf_price,
          fpzf_num:c.data.xs.fpzf_num,
          xxzf_price:c.data.sm.wxzf_price,
          xxzf_num:c.data.sm.wxzf_num,
          btzf_price:c.data.sm.btzf_price,
          btzf_num:c.data.sm.btzf_num,
          xxyezf_price:c.data.sm.yezf_price,
          xxyezf_num:c.data.sm.yezf_num,
          yezf_price:c.data.xs.yezf_price,
          yezf_num:c.data.xs.yezf_num,
          hbzf_price:c.data.xs.hbzf_price,
          hbzf_num:c.data.xs.hbzf_num,
        })
      }else{
        app.showToast(c.msg)
      }
    })
  },

  zongsy: function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: 'zongsy'
      });
    }
  },
  xianshangsy: function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: 'xianshangsy'
      });
    }
  },

  fanpiansy: function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: 'fanpiansy'
      });
    }
  },

  xianxiasy: function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: 'xianxiasy'
      });
    }
  },
  xianxiayue: function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: 'xianxiayue'
      });
    }
  },

  xianxiabatai: function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: 'xianxiabatai'
      });
    }
  },

  bataisy: function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: 'bataisy'
      });
    }
  },
  hongbao: function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: 'hongbao'
      });
    }
  },
  login: function (e) {
    wx.navigateTo({
      url: 'login'
    });
  },
  
  order:function (e) {
    var store_id = wx.getStorageSync("store_id");
    if(!store_id){
      app.showToast("请登录")
    }else{
      wx.navigateTo({
        url: '/pages/new/order'
      });
    }
  },
  tuichu:function (e) {
    // app.visit("account/endLogin", {
    //   account_id:wx.getStorageSync("account_id")
    // }, "", function(c) {
    //   console.log(c)
    //   if(0 == c.code){
    //     wx.setStorageSync("store_id","");
    //     wx.setStorageSync("account_id","");
    //     wx.navigateTo({
    //       url: 'index'
    //     });
    //   }else{
    //     app.showToast(c.msg)
        
    //   }
    // })
    wx.navigateTo({
      url: 'jiaojieb'
    });
  },

  zhuotaigl: function (e) {
    wx.navigateTo({
      url: 'zhuotaigl'
    });
  },
  tixiangl: function (e) {
    wx.navigateTo({
      url: 'tixiangl'
    });
  },
  huiyuan: function (e) {
    wx.navigateTo({
      url: 'huiyuan'
    });
  },
  huodgl: function (e) {
    wx.navigateTo({
      url: 'huodgl'
    });
  },
})